home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 215
/
215.d81
/
t.instant menu
< prev
next >
Wrap
Text File
|
2022-08-26
|
5KB
|
215 lines
u
I N S T A N T M E N U
Program by Rick Nash
Text by Fender Tucker
There are a couple of things I
hate to do in BASIC. One is print
instructions on the screen. The other
is create menus for insignificant
subroutines. I sent Rick Nash the
BASIC version of this program via
modem along with a few guidelines for
the idea. INSTANT MENU is what he sent
back -- and I must say I'm impressed.
Thanks to INSTANT MENU, I may
never have to create another menu. You
just SYS to this routine with a few
parameters and a menu is printed for
you. You have total control over text
color, box color, highlight color, and
even whether or not your menus are
double spaced.
As an added bonus, you can use
CRSR/RETURN or just press a key, 1-9.
If your menus have more than nine
items then you'll have to use
CRSR/RETURN to access 10 through xx.
[HOW TO USE]
INSTANT MENU is fairly simple to
use. It is assembled in six locations:
$0800 2048 -- page 8
$2000 8192 -- page 32
$4000 16384 -- page 64
$8000 32768 -- page 128
$C000 49152 -- page 192
$CC00 52224 -- page 204
You should be able to find a safe
place for the code to reside. You
probably already know how to bload the
program into memory:
SYS57812"i-menu $xxxx",dv,0:
poke780,0: poke781,0: poke782,page:
sys65493
The syntax:
SYSaddr,items,x,y,box color,highlight
color,text color, "item", <"list",...>
Here is a breakdown of the
parameters:
ITEMS: the number of items that will
be in your menu. When a menu is
created, the current screen will be
saved at $d000-d800. When an item is
selected, the menu will disappear. If
you don't want your screen saved and
you don't want the menu to disappear
when an item is selected, add 64 to
this number.
X: Beginning X column (0-39) on the
screen. Naturally you won't begin a
menu at 39.
Y: Beginning Y row (0-24) on the
screen. Your beginning row should be
at least 24 minus the number of items
(24-(items)). Make that 24-(items*2)
if your menu will be double spaced.
BOX COLOR: This specifies the color of
the box that will be drawn around your
items in the menu. If you want a
DOUBLE-SPACED menu, add 64 to the box
color. If you want NO BOX, add 128 to
the box color.
HIGHLIGHT COLOR: This is the color of
the current item on the menu. It can
be a different color from the items in
the rest of the menu if you want it to
be.
TEXT COLOR: This will be the color of
the items in the menu when they are
not highlighted.
"ITEM",<"LIST",...>: These are the
items in your menu. They should be
within quotes unless they are string
variables. You can have as many items
as you can fit on a line -- or on your
screen. You can fit more on a line if
you use string variables.
If your menus are going to
overwrite a portion of the screen,
then you might want to fill spaces so
that all items are the same length as
the longest item on the list. This way
nothing will show beneath your menus.
When an item is selected and the
menu returns control to your BASIC
program, you can tell what item was
selected by getting a key from the
keyboard buffer:
GET A$
If item one was selected, then A$
will be "1". If item seven was
selected, A$ will be "7" and so on.
NOTE: if your menu has more than nine
items in it then the ASCII values
following 9 will be used instead of
the actual numbers, 10-24. Your BASIC
code should be ready for that. One
easy way is this:
A=ASC(A$)-48
ON A GOSUB...,...,...,...
But most menus won't have more
than nine items so you probably won't
have to worry about that.
So INSTANT MENU might look like
this in your code:
SYSmenu:GETA$:ONVAL(A$)GOTO100,200,300
You can use ON VAL(A$) GOSUB or
GOTO in order to direct your program
flow. For more information on ON
GOSUB, see BEGINNING BASICS in
ZP:Basics in this issue.
Note from Jeff: Since INSTANT MENU
can store and restore a screen, I
think the power of a screen switcher
should be capitalized on, so I added
the ability for you to store and
retrieve up to nine screens under ROM
areas.
The SCREEN STASH command is
simple:
SYS 49155,screen
For other versions of INSTANT MENU
it's addr+3.
The screen can be 0-8. The
eight screens are completely beneath
ROMs and don't touch areas normally
accessed by BASIC programs. Your
border and background colors are
stored with the screen.
The SCREEN RESTORE command gets
the screen back:
SYS 49158,screen
For other versions of INSTANT MENU,
it's addr+6.
The screens are stored at:
$A000, $A800, $B000, $B800,
$D000, $D800, $E000, $E800, $F000
These are the RAM locations of
screens 0-8 respectively. Naturally
you can use any screen you like in
order to ensure compatibility with
other utilities you may be using.
The possibilities are endless.
Have fun (and profit) with the new
power.
JLJ
21st Century Note: Ah HAH! The
beginning of the Toolbox concept. As I
browse through early LOADSTAR
programs, I notice that many use a
bunch of small modules, often put
together by an assembler. The
integration of routines in Toolboxes
has become the trademark of LOADSTAR
programming. And here you can see it
coming together.
DMM